package com.lyf.baoxian.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;

import com.lyf.baoxian.R;
import com.lyf.baoxian.adapter.SearchAdapter;
import com.lyf.baoxian.bean.SearchCustomer;
import com.lyf.baoxian.utils.MyMethod;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 刘亚飞 on 2017/1/8.
 */

public class BaodanActivity extends Activity implements View.OnClickListener {
    private List<SearchCustomer> datas;
    private ListView lv;
    private ViewGroup title;
//    private LinearLayout ll_show;
    private Button bt_show;

    private boolean isShow = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);
        intdata();
        initView();

    }

    private void initView() {
//        ll_show = (LinearLayout) findViewById(R.id.ll_show);
        title = (ViewGroup) findViewById(R.id.lv_title);
        title.setBackgroundResource(R.color.home_tab);
        lv = (ListView) findViewById(R.id.lv_search);
        bt_show = (Button) findViewById(R.id.bt_right);

        SearchAdapter adapter = new SearchAdapter(BaodanActivity.this);
        adapter.setDatas(datas);
        lv.setAdapter(adapter);
    }

    private void intdata() {
        MyMethod.setTitle(BaodanActivity.this, "保单");
        datas = new ArrayList<>();
        for (int i = 0; i < 30; i++) {
            datas.add(new SearchCustomer("2016-12-31", "玉米指数", "张飒", "56¥"));
        }

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_right:
                /*if (isShow) {
                    ll_show.setVisibility(View.GONE);
                    isShow = !isShow;
                    bt_show.setText("筛选");
                } else {
                    ll_show.setVisibility(View.VISIBLE);
                    isShow = !isShow;
                    bt_show.setText("收起");
                }*/
                break;
        }
    }
}
